home *** CD-ROM | disk | FTP | other *** search
- Bpp - Basic Pre-processor
- © 1990 by Steven D. Kapplin
- CIS 70055,1021
-
- Bpp is a simple pre-processor which reads in a Basic source program,
- identifies the subroutines and functions, then searches a second
- library file and extracts the subroutines and functions. It then
- either appends them to the source program or writes them out to a
- separate file for use as an INCLUDE file.
-
- Bpp is written in HiSoft Basic. The source and executable are
- included in this archive. Bpp runs only from the CLI. The
- syntax is:
-
- Bpp PgmFile LibFile [OutFile]
-
- The last parameter, OutFile, is optional. If a "?" is used in
- place of PgmFile or if the command line is blank, then Bpp will
- provide a simple syntax help message.
-
- In order to make Bpp as efficient and simple as possible, your
- Basic source files should follow this format:
-
- The beginning of your source file should contain a REM statement
- followed by the keyword EXTERNAL. The next several lines will
- contain REM statements followed by the names of the subroutines
- or functions you want appended to the source file. Each
- subroutine or function should be preceeded by its corresponding
- keyword, FUNCTION or SUB. The last line will contain a REM
- statement followed by the keyword ENDEXTERNAL. Following is an
- example:
-
- REM My Basic Program
- REM
- REM EXTERNAL
- REM FUNCTION func1
- REM SUB sub1
- REM SUB sub2
- REM FUNCTION func2
- REM ENDEXTERNAL
- REM
- .
- .
- .
- . program source
- .
- .
- .
- .
-
- Although this may seem somewhat confining, given Basic's rather
- freeform programming style, it makes searching for SUBs and
- FUNCTIONs much easier. Note that Bpp will not recognize the DEF
- FNfuncname, END DEF form of defining a function. To make things
- easier, I have made it necessary to use the FUNCTION, END
- FUNCTION form of defining a function. Because either form is
- acceptable in HiSoft, this shouldn't create too many problems.
-
- Your library must also follow certain conventions for Bpp. The library
- should be structured as follows:
-
- REM sub1 or function1 name
- SUB subname1(parm1,parm2,...)
- .
- .
- . source code
- .
- .
- END SUB
-
- REM sub2 or function 2 name
- FUNCTION funcname1(parm,parm,...)
- .
- .
- . source code
- .
- .
- END FUNCTION
-
- The keywords FUNCTION and END FUNCTION may be used in place of
- SUB and END SUB if you want to define a FUNCTION. Your library
- should have NO REMs other than one that immediately preceeds EACH
- function or subroutine definition. If you need remarks use the
- "'" instead of REM. The REM is followed only by the name. Do
- not use any "()".
-
- You will also note that Bpp is written primarily to support
- HiSoft Basic rather than AmigaBasic. Although this will work
- with AmigaBasic, you can only use subroutines because AmigaBasic
- does not support the FUNCTION, END FUNCTION keywords.
-
- Bpp will check the command line and will provide appropriate
- error messages is files are not found or parameters not
- specified.
-
- Bpp makes possible the compilation of one library file containing
- all your favorite subroutines and functions. By listing the
- needed ones in your program using the format specified above, you
- can then "link" the needed routines into your main source program
- or create a separate INCLUDE file. This makes using HiSoft Basic
- a little more like a true compiler system.
-
- If you make any modifications to this program, please be sure to
- post your contribution on CompuServe's AmigaTech SIG for the rest
- of us to enjoy. Feel free to add your Copyright to mine as I lay
- claim only to this initial contribution. If you make changes or
- additions, take credit for them, but please don't delete mine. I
- make no claims regarding the usefulness of this program nor do I
- make any guarantees that it will run flawlessly. If it damages
- your system, files, etc., I am not responsible. Use at your own
- risk.
-